/*** Eclipse Class Decompiler plugin, copyright (c) 2012 Chao Chen (cnfree2000@hotmail.com) ***/
package com.qihoo.gamecenter.sdk.login.plugin.a;

import android.os.Handler;
import com.qihoo.gamecenter.sdk.login.plugin.login.c;
import org.json.JSONException;
import org.json.JSONObject;

public abstract class g {
    protected c b;
    protected e c;
    private long a;
    private Handler d = new Handler();

    public g(long paramLong, c paramc, e parame) {
        this.a = paramLong;
        this.b = paramc;
        this.c = parame;
    }

    public abstract void a();

    protected abstract void b();

    protected void a(JSONObject paramJSONObject) {
        if (this.a > 0L) {
            long l1 = System.currentTimeMillis() - this.a;
            com.qihoo.gamecenter.sdk.login.plugin.h.e.a("LoginReq", new Object[] { "pastedTime=" + l1 });
            long l2 = 3000L - l1;
            if ((l1 > 0L) && (l2 > 0L)) {
                this.d.postDelayed(new Runnable(paramJSONObject) {
                    public void run() {
                        g.this.c(this.a);
                    }
                }, l2);
                com.qihoo.gamecenter.sdk.login.plugin.h.e.a("LoginReq", new Object[] { "lefttime=" + l2 });
            }
            else {
                c(paramJSONObject);
            }
        }
        else {
            c(paramJSONObject);
        }
    }

    protected void b(JSONObject paramJSONObject) {
        if ((paramJSONObject != null) && (!(paramJSONObject.has("errno"))))
            try {
                paramJSONObject.put("errno", -1);
            } catch (JSONException localJSONException) {
                com.qihoo.gamecenter.sdk.login.plugin.h.e.b("LoginReq", "notifyLoginFail error!", localJSONException);
            }
        c(paramJSONObject);
    }

    protected void c(JSONObject paramJSONObject) {
        if ((this.c != null) && (!(this.c.b()))) {
            com.qihoo.gamecenter.sdk.login.plugin.h.e.a("LoginReq", new Object[] { "notifyLogin="
                    + ((paramJSONObject != null) ? paramJSONObject.toString() : "null") });
            this.c.a(paramJSONObject);
        }
        b();
    }

    protected JSONObject a(boolean paramBoolean) {
        JSONObject localJSONObject = null;
        int i = (paramBoolean) ? 4005 : 4003;
        String str = (paramBoolean) ? "login get qt failed!" : "login get token failed!";
        try {
            localJSONObject = new JSONObject();
            localJSONObject.put("inner_errno", i);
            localJSONObject.put("inner_errmsg", str);
        } catch (Exception localException) {}
        return localJSONObject;
    }
}